const express = require("express");
const router = express.Router();

const Book = require("@controller/books");

router.get("/getbook", (req, res, next) => {
  const { is_all } = req.query;
  if (is_all === undefined) {
    res.json({
      result: -1,
      errMsg: "缺失参数",
    });
    return;
  } else {
    if (parseInt(is_all) === 1) {
      Book.getAllbooks(req, res, next);
    } else {
      Book.getAllbookById(req, res, next);
    }
  }
});

module.exports = router;
